package org.shoukaiseki.supersaiyan.db.inittable.system;

import org.shoukaiseki.inittable.domain.TableColumnInfo;
import org.shoukaiseki.inittable.domain.TableIndexInfo;
import org.shoukaiseki.inittable.service.ITableBuildInfoService;
import org.shoukaiseki.kakaroto.annotation.TableBuild;

import java.util.List;

import static org.shoukaiseki.inittable.utils.SksColumnCamelCaseCommon.uniqueId;
import static org.shoukaiseki.inittable.utils.TableColumnInfoBuilder.column;
import static org.shoukaiseki.inittable.utils.TableIndexInfoBuilder.uniqueIndex;
import static org.shoukaiseki.inittable.utils.TableInfoUtils.tableColumns;
import static org.shoukaiseki.inittable.utils.TableInfoUtils.tableIndexs;

/**
 *
 **/
@TableBuild(name = "sys_config", comment = "参数配置表",version = 1)
public class SysConfigInitTable implements ITableBuildInfoService {


    @Override
    public List<TableColumnInfo> tableColumnInfoList(){
        List<TableColumnInfo> table = tableColumns(

                uniqueId("config_id","参数主键"),
                column("	config_name  varchar(100) default ''  null comment '参数名称',"),
                column("	config_key   varchar(100) default ''  null comment '参数键名',"),
                column("	config_value varchar(500) default ''  null comment '参数键值',"),
                column("	config_type  char         default 'N' null comment '系统内置（Y是 N否）',"),
                column("	bit_type     tinyint(8)   default '0' not null comment '类型',")
                        .description("&1: 功能配置可见"),
                column("	create_by    varchar(64)  default ''  null comment '创建者',"),
                column("	create_time  datetime                 null comment '创建时间',"),
                column("	update_by    varchar(64)  default ''  null comment '更新者',"),
                column("	update_time  datetime                 null comment '更新时间',"),
                column("	remark       varchar(500)             null comment '备注'"),


                null
        );

        return table;
    }

    @Override
    public List<TableIndexInfo> tableIndexInfoList() {
        return tableIndexs(
                uniqueIndex("udx_config_name").indexColumns("config_name"),
                null
        );
    }
}
